package com.hframe.typefilter;


import com.hframe.utils.Timestamp;

public class StringToTimestamp implements FilterRef<Timestamp, Object> {

	@Override
	public Timestamp filter(Object object) {
		if (null != object) {
			if (object instanceof String) {
				return parse((String) object);
			} else if (object instanceof Long) {
				return parse((Long) object);
			}
		}
		return null;
	}

	public static Timestamp parse(Long object) {
		if (null == object)
			return null;
		return new Timestamp(object);
	}

	public static Timestamp parse(String object) {
		if (null == object)
			return null;
		return parse(StringToLong.parse(object));
	}
}
